Open Bug 1868296 Opened 1 years ago Updated 2 months ago

fix a clippy warning in glean/api/src/private/event.rs

Categories

(Developer Infrastructure :: Lint and Formatting, task)

Tracking

(firefox135 affected)

135 Branch
Tracking Status
firefox135 --- affected

People

(Reporter: Sylvestre, Unassigned, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, leave-open, Whiteboard: [lang=rust])

Attachments

(3 files, 4 obsolete files)

Filling as a good first bug to learn workflows.

toolkit/components/glean/api/src/private/event.rs
  110:29  warning  use of `.unwrap_or_else(..)` to construct default value  clippy::unwrap_or_else_default (clippy)

Links to the code:
https://searchfox.org/mozilla-central/rev/78a2c17cc80680a5a82446e4ce7c45a73b935383/toolkit/components/glean/api/src/private/event.rs#110

To run clippy:

./mach lint -l clippy toolkit/components/glean/api/src/ -W -v    

As the change is trivial, it is just to learn how to contribute to Firefox.

Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html

Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.

Assignee: nobody → asthetiklee
Status: NEW → ASSIGNED

Comment on attachment 9372689 [details]
Bug 1868296 - Fix clippy warnings. r=Sylvestre

Revision D198488 was moved to bug 1868293. Setting attachment 9372689 [details] to obsolete.

Attachment #9372689 - Attachment is obsolete: true
Attachment #9372693 - Attachment is obsolete: true
Attachment #9372696 - Attachment is obsolete: true
Attachment #9372700 - Attachment description: Bug 1868296 - Fix clippy warnings. r=sylvestre → Bug 1868296 - Fix a clippy warning in glean-ffi r=sylvestre
Attachment #9372700 - Attachment description: Bug 1868296 - Fix a clippy warning in glean-ffi r=sylvestre → Bug 1868296 - Fix a clippy warning in glean-private r=sylvestre
Pushed by sledru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/860832637944 Fix a clippy warning in glean-private r=sylvestre

There is an r+ patch which didn't land and no activity in this bug for 2 weeks.
:asthetiklee, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(sledru)
Flags: needinfo?(asthetiklee)

inactive, this is opened for a new contributor!

Assignee: asthetiklee → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(sledru)
Flags: needinfo?(asthetiklee)

Replaced extra.unwrap_or_else(HashMap::new) with extra.unwrap_or_default() in EventMetric implementation.
Aligns with Clippy's recommendation to use .unwrap_or_default() for simplifying the default value logic.
Improves code readability and maintains idiomatic Rust style.

Assignee: nobody → asthetiklee
Status: NEW → ASSIGNED
Pushed by sledru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9373fb1b31f5 Replace `unwrap_or_else` with `unwrap_or_default` for cleaner code. r=sylvestre

Simplify the handling of the extra variable by combining the conversion and default assignment into a single if let statement.
This reduces unnecessary variable assignments and makes the code more concise.

Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 135 Branch

Reopened for unpublished changesets.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Keywords: leave-open
Pushed by sledru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b4e24913cd9c Optimize EventMetric::Child match arm in record method. r=sylvestre
Attachment #9377248 - Attachment is obsolete: true

This good-first-bug hasn't had any activity for 2 months, it is automatically unassigned.
For more information, please visit BugBot documentation.

Assignee: asthetiklee → nobody
Status: REOPENED → NEW
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: